<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../js/vue.js"></script>
    <style>
        .success {
            border: 5px solid green;
            width: 100px;
            height: 100px;
        }

        .error{
            background-color: red;
        }
    </style>
</head>
<body>

<div id="div1">
<!--绑定数组-->
    <div v-bind:class="[successClass,errorClass]">
        测试代码
    </div>
    <button @click="handle">切换样式</button>

</div>

<script>

    const vueObj = new Vue({
        el:'#div1',
        data: {
            successClass: 'success',
            errorClass: 'error',



        },
        methods:{
            handle:function(){
                //取消样式
                this.successClass = '';
                this.errorClass = '';
            },
        }
    });
</script>
</body>
</html>